package com.joy.conf.runner;

import com.joy.web.admin.service.ICommonCdService;
import com.joy.web.admin.service.IResourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @ClassName: MyInitRunner
 * @Description: 项目启动后初始化数据
 * @Author: yjzhao
 * @Create: 2019-09-17  21:42
 **/
@Component
@Slf4j
public class MyInitRunner implements ApplicationRunner {

    @javax.annotation.Resource
    private IResourceService resourceService;
    @javax.annotation.Resource
    private ICommonCdService commonCdService;

    @Override
    public void run(ApplicationArguments args) throws Exception {

        log.info("start init MyInitRunner ...");

        //resource 全部放入缓存中
        resourceService.initAllResourceToCache();

        //常量 全部放入缓存中
        commonCdService.findAllCommonCdTree();


    }
}
